<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
     <meta content="telephone=no" name="format-detection" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable = no"/>
    <title>基本信息设置</title>
    <link href="__PUBLIC__/wap/css/rest.css"  rel="stylesheet">
    <link href="__PUBLIC__/wap/css/user.css"  rel="stylesheet">
    <link href="__PUBLIC__/wap/css/mobiscroll.custom-2.5.0.min.css" rel="stylesheet" type="text/css"/>
</head>
<body id="u-body">
<!--绑定头部-->
<include file="Public/binding_head"/>
<!--绑定头部-->

<header id="header" class="u-header clearfix">
        <div class="u-hd-left f-left">
            <a href="{:U('wap/member/setup')}" class="J_backToPrev"><span class="u-icon-px i-hd-back"></span></a>
        </div>
        <div class="u-hd-tit"><span>基本信息设置</span></div>
    </header>
     <form action="" role="form" id="form2" novalidate="novalidate" method="post" onSubmit="return false;"  >
    <div class="ui-form ui-border-b">
        <div class="ui-form-item ">
            <label>昵称</label>
            <input class="ui-border-bi" id="member_name" name="member_name" type="text" value="{$member.member_name}" maxlength="50" emptymsg="设置昵称" errormsg="请填写1~16位中文姓名" datatype="c16">
        </div>
        <div class="ui-form-item ">
            <label>生日</label>
            <input class="ui-border-bi" id="birthday" name="birthday" value="{$data.birthday}" maxlength="50" emptymsg="设置生日" errormsg="请填写生日" datatype="c16">
        </div>
        <div class="ui-form-item ">
            <label>爱好</label>
            <input class="ui-border-bi" name="hobby" id="hobby" type="text" value="{$data.hobby}" maxlength="50" emptymsg="设置爱好" errormsg="请填写爱好" datatype="c16">
        </div>
        <div class="ui-form-item ">
           <div   style="     max-width: 290px;line-height: 16px;margin: 3px auto;   color: #ff3c3c;"><span class="icon-warning icon_warning"></span>&nbsp;地区信息设置后不能更改</div>
        </div>
        <div class="ui-form-item">
            <label>省份</label>
            <div class="ui-select ui-border-bi disabled">
                <if condition="(!empty($city))">
                    <input type="hidden" id="provinceid" name="provinceid" value="{$data.provinceid}" />{$city.province.province}
                    <else />
                    <select id="provinceid" name="provinceid" class="city_p" {$disable}
                            onchange="choice_province('city')" emptymsg="请选择省" datatype="*">
                        <option value="0">请选择</option>
                        <volist name="citylist['province']" id="vo">
                            <option value="{$vo.cityid}"
                            <if condition="$data['provinceid']==$vo['cityid']">selected</if>
                            >{$vo.cityname}</option>
                        </volist>
                    </select>
                </if>
            </div>
        </div>
        <div class="ui-form-item ">
            <label>城市</label>
            <div class="ui-select ui-border-bi disabled">
                <if condition="(!empty($city))">
                    <input type="hidden" id="cityid" name="cityid" value="{$data.cityid}" />{$city.city.city}
                    <else />
                    <select id="cityid" name="cityid" class="city_c" {$disable} onchange="choice_city('city')"
                            emptymsg="请选择市" datatype="*">
                        <option value="0">请选择</option>
                        <volist name="citylist['city']" id="vo">
                            <option value="{$vo.cityid}"
                            <if condition="$data['cityid']==$vo['cityid']">selected</if>
                            >{$vo.cityname}</option>
                        </volist>
                    </select>
                </if>
            </div>
        </div>
        <div class="ui-form-item ">
            <label>区县</label>
            <div class="ui-select ui-border-bi disabled">
                <if condition="(!empty($city))">
                    <input type="hidden" id="areaid" name="areaid" value="{$data.areaid}" />{$city.area.area}
                    <else/>
                    <select id="areaid" name="areaid" class="city_a" {$disable} emptymsg="请选择区" datatype="*">
                        <option value="0">请选择</option>
                        <volist name="citylist['area']" id="vo">
                            <option value="{$vo.cityid}"
                            <if condition="$data['areaid']==$vo['cityid']">selected</if>
                            >{$vo.cityname}</option>
                        </volist>
                    </select>
                </if>
            </div>
        </div>
        <div class="ui-form-item class="ui-border-bi" ui-form-item-textarea">
            <label>详细地址</label>
            <textarea  name="addr" id="addr" rows="5" emptymsg="请填写详细地址" datatype="*">{$data.addr}</textarea>
        </div>
    </div>
</form>

    <a href="javascript:void(0);" class="new-abtn-type new-mg-tb30 phone_log_btn">确认修改</a>

<div style="height:40px;">
   </div> 
     <!--end top-->
   <include file="Public/footer" />
<include file="Public/wap_javascript"/>
<script type="text/javascript">
    var binding_is_check = 0;// 重复再次弹出 1是 0否
    var binding_page = 'member_basic';// //当前页面名称 不可重复
</script>
<!--绑定-->
<include file="Public/binding_phone"/>
<!--绑定-->
      <!--微信分享-->    
 <include file="Public/share_weixin" />

    <!--<script src="__PUBLIC__/bootstrap/vendor/jquery-validation/jquery.validate.min.js"></script>-->
    <script src="__PUBLIC__/bootstrap/vendor/jquery-validation/jquery.validate.wap.js"></script>
     <script src="__PUBLIC__/js/jquery.form.js"></script>
    <script src="__PUBLIC__/wap/js/mobiscroll.custom-2.5.0.min.js" type="text/javascript"></script>
     <script type="text/javascript" src="__PUBLIC__/layer/layer.js"></script>
    <script>
    var get_city_url="{:U('wap/index/get_city')}";
    </script>   
     <script src="__PUBLIC__/js/common.js"></script>
    <script>
        jQuery(document).ready(function () {
            //FormValidator.init();

            jQuery.validator.addMethod("byteRangeLength", function (value) {
                var areaid = $("#areaid").val();
                var cityid = $("#cityid").val();
                var provinceid = $("#provinceid").val();
                var ret = false;
                if (areaid > 0 && cityid > 0 && provinceid > 0) {
                    ret = true;
                }
                return ret;
            });

            $("#form2").validate({
                rules: {
                    member_name: 'required',
                    areaid: 'byteRangeLength',
                    addr: 'required'
                },
                messages: {
                    member_name: '<span class="icon-warning icon_warning"></span>&nbsp;请输入昵称',
                    areaid: '<span class="icon-warning icon_warning"></span>&nbsp;请选择完整的省市区',
                    addr: '<span class="icon-warning icon_warning"></span>&nbsp;请输入详细地址'
                },
                focusInvalid: false,
                success: function (label) {
                    // set  as text for IE 
                    // alert('ok'); 
                    //label.html(" ").addClass("checked"); 
                },
                /*执行ajaxsubmit  */
                submitHandler: function (editform) {

                    var options = {
                        url: "<?php echo U('Wap/Member/basic_set'); ?>",
                        type: "post",
                        dataType: 'json',
                        target: "#loader",
                        error: function () {
                            layer.msg("服务器没有返回数据，可能服务器忙，请重试",{icon:5});
                        },
                        onwait: "正在处理信息，请稍候...",
                        success: function (response) {
                            console.log(response);
                            //$("#loader").fadeIn(500).html(response.data).fadeOut(500); 
                            //$('#editform').hide(2000); 
                            if (response.status == 1) {
                               // alert("修改成功");
                               layer.msg('修改成功', {icon: 6}); 
                                window.location.href = "<?php echo U('Wap/Member/setup'); ?>";
                            } else {
                                 layer.msg(response.error, {icon: 5}); 
                                //alert(response.error);
                            }
                        }
                    };
                    setTimeout((function (opt) {
                        return function () {
                            $('#form2').ajaxSubmit(opt);
                        }
                    })(options), 300);
                    return false;
                }

            });
            $('.phone_log_btn').click(function () {
                $('#form2').submit();
            });

        });
    </script>

   <!-- mobiscroll star-->
<script type="text/javascript" >
    type = "text/javascript" >
            $(function () {
                $("#birthday").mobiscroll().date();

                var currYear = (new Date(1965)).getFullYear();  //设定起始年份
                var endYear = (new Date()).getFullYear();    //设定结束年份

                //初始化日期控件
                var opt = {
                    preset: 'date', //日期，可选：date\datetime\time\tree_list\image_text\select
                    theme: 'default', //皮肤样式，可选：default\android\android-ics light\android-ics\ios\jqm\sense-ui\wp light\wp
                    display: 'modal', //显示方式 ，可选：modal\inline\bubble\top\bottom
                    mode: 'scroller', //日期选择模式，可选：scroller\clickpick\mixed
                    lang: 'zh',
                    dateFormat: 'yyyy-mm-dd', // 日期格式
                    setText: '确定', //确认按钮名称
                    cancelText: '取消',//取消按钮名籍我
                    dateOrder: 'yyyymmdd', //面板中日期排列格式
                    dayText: '日', monthText: '月', yearText: '年', //面板中年月日文字
                    showNow: false,
                    nowText: "今",
                    startYear: currYear - 5, //开始年份
                    endYear: endYear //结束年份
                    //endYear:2099 //结束年份
                };

                $("#birthday").mobiscroll(opt);
            });
</script>
    <!-- mobiscroll end-->
</body>
</html>